'use strict';
exports.main = async (event, context) => {
	const db = uniCloud.database()
	return new Promise((resolve,rejects) => {
		if(event.index==0){
			db.collection('TodoList').where({
				isOver:false
			}).orderBy('strWarn',"desc").get().then((res) =>{
				resolve(res)
			}).catch((err)=>{
				rejects(err)
			})
		}else{
			db.collection('TodoList').where({
				isOver:true
			}).orderBy('strWarn',"desc").get().then((res) =>{
				resolve(res)
			}).catch((err)=>{
				rejects(err)
			})
		}
		
	})
};
